// Copyright (C) ZHENG Zhong <heavyzheng nospam-at gmail D0T com>
//
// $Id: actual_360.hpp 225 2008-09-12 17:43:02Z heavyzheng $
//

#ifndef ZZHENG_QUANT_DATES_ACTUAL_360_COUNTER_HPP_20080811__
#define ZZHENG_QUANT_DATES_ACTUAL_360_COUNTER_HPP_20080811__

#include <zzheng/quant/dates/config.hpp>
#include <zzheng/quant/dates/date.hpp>
#include <zzheng/quant/dates/calendar.hpp>

namespace zzheng {
namespace quant {
namespace dates {
namespace detail {

    //! The actual/360 day count convention.
    //! year_fraction = (end - start) / 360
    class actual_360 {

    public:

        explicit actual_360() {
            // Do nothing.
        }

        // Use auto-generated copy constructor.
        // Use auto-generated copy assignment.
        // Use auto-generated destructor.

        double year_fraction(const date& start, const date& end, const calendar&) const {
            double numerator   = end.julian_day() - start.julian_day();
            double denominator = 360.0;
            return ( numerator / denominator );
        }

    }; // class actual_360

} // namespace zzheng::quant::dates::detail
} // namespace zzheng::quant::dates
} // namespace zzheng::quant
} // namespace zzheng


#endif // ZZHENG_QUANT_DATES_ACTUAL_360_COUNTER_HPP_20080811__



